package com.bing.bean.Tpp.tuling;

import com.bing.bean.weixin.Article;
import com.bing.bean.weixin.RequestMessage;
import com.bing.bean.weixin.ResponseMessage;
import com.bing.utils.MsgHelper;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/6.
 */
public class Trains extends AbstractMsg {
    private List<Train> list = new ArrayList<>();

    public List<Train> getList() {
        return list;
    }

    public void setList(List<Train> list) {
        this.list = list;
    }

    @Override
    public ResponseMessage toMsg(RequestMessage requestMessage) {
        List<Article> articles = new ArrayList<>();
        int i = 1;
        for (Train n : list) {
            if (i > 10) {
                break;
            }
            i++;
            Article article = new Article();
            article.setContent(n.getStarttime() + "-----" + n.getEndtime());
            article.setDescription(n.getStart() + "----" + n.getTerminal() + "\n" + n.getStarttime() + "-----" + n.getEndtime());
            article.setPicUrl(n.getIcon());
            article.setUrl(n.getDetailurl());
            article.setTitle(n.getTrainnum() + "" + n.getStart() + "  " + n.getTerminal() + "\n" + n.getStarttime() + "-----" + n.getEndtime());
            articles.add(article);
        }

        return MsgHelper.toNews(requestMessage, articles);
    }

    public class Train {

        private String trainnum;
        private String start;
        private String terminal;
        private String starttime;
        private String endtime;
        private String icon;
        private String detailurl;

        public String getTrainnum() {
            return trainnum;
        }

        public void setTrainnum(String trainnum) {
            this.trainnum = trainnum;
        }

        public String getStart() {
            return start;
        }

        public void setStart(String start) {
            this.start = start;
        }

        public String getTerminal() {
            return terminal;
        }

        public void setTerminal(String terminal) {
            this.terminal = terminal;
        }

        public String getStarttime() {
            return starttime;
        }

        public void setStarttime(String starttime) {
            this.starttime = starttime;
        }

        public String getEndtime() {
            return endtime;
        }

        public void setEndtime(String endtime) {
            this.endtime = endtime;
        }

        public String getIcon() {
            return icon;
        }

        public void setIcon(String icon) {
            this.icon = icon;
        }

        public String getDetailurl() {
            return detailurl;
        }

        public void setDetailurl(String detailurl) {
            this.detailurl = detailurl;
        }
    }
}
